package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.MatRepairDete;
import com.indusfo.spc.service.MatRepairDeteService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰 物料维修流程采集项目
 * @Date: 2019/11/25 9:58
 */
@Controller
@RequestMapping("/service/matRepairDete")
public class MatRepairDeteController {
	@Autowired
	private MatRepairDeteService matRepairDeteService;

	/**
	 * 查询
	 */
	@RequestMapping(value = "/queryMatRepairDete")
	@ResponseBody
	public JSONObject queryMatRepairDete(MatRepairDete matRepairDete) {
		JSONObject json = matRepairDeteService.queryMatRepairDete(matRepairDete);
		return json;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/insertMatRepairDete", method = RequestMethod.POST)
	@ResponseBody
	public JSONObject insertMatRepairDete(MatRepairDete matRepairDete) {
		JSONObject json = matRepairDeteService.insertMatRepairDete(matRepairDete);
		return json;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/updateMatRepairDete", method = RequestMethod.POST)
	@ResponseBody
	public JSONObject updateMatRepairDete(MatRepairDete matRepairDete) {
		JSONObject json = matRepairDeteService.updateMatRepairDete(matRepairDete);
		return json;
	}

	/**
	 * 删除
	 */
	@RequestMapping(value = "/deleteMatRepairDete", method = RequestMethod.POST)
	@ResponseBody
	public JSONObject deleteMatRepairDete(@RequestParam("matRepairDeteIds") List<Integer> matRepairDeteIds, Integer dataState) {
		dataState = 2;
		JSONObject json = matRepairDeteService.deleteMatRepairDete(matRepairDeteIds, dataState);
		return json;
	}

	/**
	 * 启停
	 */
	@RequestMapping(value = "/definedMatRepairDete", method = RequestMethod.POST)
	@ResponseBody
	public JSONObject definedMatRepairDete(@RequestParam("matRepairDeteIds") List<Integer> matRepairDeteIds, Integer dataState) {
		JSONObject json = matRepairDeteService.deleteMatRepairDete(matRepairDeteIds, dataState);
		return json;
	}
}
